import request from '@/plugins/axios'

// 查询菜单分页
export function menuPage(data) {
    return request({
        url: '/sys/menu/page',
        method: 'post',
        data: data
    })
}

// 查询菜单列表
export function menuList(data) {
    return request({
        url: '/sys/menu/list',
        method: 'post',
        data: data
    })
}

// 查询菜单详细
export function menuDetail(id) {
    const data = {
        id : id
    };
    return request({
        url: '/sys/menu/detail',
        method: 'post',
        data
    })
}

// 查询菜单下拉树结构
export function menuTree() {
    return request({
        url: '/sys/menu/tree',
        method: 'post'
    })
}

export function treeSelect(data) {
    return request({
        url: '/sys/menu/treeSelect',
        method: 'post',
        data
    })
}

// 根据角色ID查询菜单下拉树结构
export function treeSelectMenuByRole(roleId) {
    const data = {
        id : roleId
    };
    return request({
        url: '/sys/menu/treeSelectByRole',
        method: 'post',
        data
    })
}

// 新增菜单
export function menuAdd(data) {
    return request({
        url: '/sys/menu/add',
        method: 'post',
        data: data
    })
}

// 修改菜单
export function menuUpdate(data) {
    return request({
        url: '/sys/menu/update',
        method: 'post',
        data: data
    })
}

// 删除菜单
export function menuDelete(id) {
    const data = {
        id: id
    };
    return request({
        url: '/sys/menu/delete/',
        method: 'post',
        data
    })
}


